import React, { Component } from 'react';
import connect from './connect'
import connect2 from './connect2'

import Header from './ui/Header';
import SearchNav from '@/components/SearchNav'
import List from './ui/List';

@connect
@connect2
class index extends Component {

  state = {
    listDataIndex: 0,
    setListDataIndex: (index) => this.setState({ listDataIndex: index })
  }

  componentDidMount() {
    this.props.getCategoryData()
    this.props.getMaterialData()
  }

  render() {
    return (
      <>
        {/* 为了实现左右两侧拉动不影响，一定要在此设置  overflow: 'hidden' */}
        <div style={{ height: '100%', overflow: 'hidden' }}>
          <Header {...this.state} />
          {/* 搜索 */}
          <SearchNav />
          {/* 列表展示 */}
          <List listDataIndex={this.state.listDataIndex} />
        </div>
      </>
    );
  }
}

export default index;
